home *** CD-ROM | disk | FTP | other *** search
/ Mac Mania 1 / MacMania 1.toast / Hypercard / HyperCard' More / C-D / CheckWriter / Check Writer / background_2720.txt < prev    next >
Encoding:
Text File  |  1987-09-30  |  9.1 KB  |  404 lines

  1. -- background: 2720 from stack: in
  2. -- bmap block id: 2129
  3. -- flags: 4000
  4. -- background id: 0
  5. -- name: Check
  6. ----- HyperTalk script -----
  7. on newCard
  8.   type tab & tab
  9. end newCard
  10.  
  11. on openCard
  12.   if bkgnd field "Print" is empty then put false into bkgnd field "Print"
  13.   put number of this card - the number of first card of this bkgnd + 1 into field "Number"
  14.   setPrintButton
  15.   get item 1 to 2 of rect of bkgnd field "Pay to"
  16.   click at it
  17.   tabKey
  18. end openCard
  19.  
  20. on closeField
  21.   put true into bkgnd field "Print"
  22.   send setPrintButton
  23. end closeField
  24.  
  25. on setPrintButton
  26.   set hilite of bkgnd button "Print" to bkgnd field "Print"
  27. end setPrintButton
  28.  
  29. --  TextAmount -- returns text version of numeric dollars and cents
  30. --  amount.
  31.  
  32. function textAmount amount
  33. put char (number of chars in amount) - 2 to (number of chars in amount) of amount into cents
  34. get trunc(amount)
  35. if it is 0 then get "zero "
  36. else
  37.   put it mod 100 into units
  38.   put it div 100 into hundreds
  39.   get empty
  40.   if hundreds is not zero then
  41.     if hundreds mod 10 is zero then get text100(hundreds div 10) && "thousand "
  42.     else get text100(hundreds) && "hundred "
  43.   end if
  44.   if units is not zero then put text100(units) & space after it
  45. end if
  46. put "and " & cents & "*****************************************************************" after it
  47. put toUpper(first char of it) into first char of it
  48. return it
  49. end textAmount
  50.  
  51. -- text100 -- Utility function for textAmount.
  52.  
  53. function text100 n
  54. put "one two three four five six seven eight nine ten" && "eleven twelve thirteen fourteen fifteen sixteen seventeen" && "eighteen nineteen" into digits
  55. -- handle number less than 20
  56. if n < 20 then
  57.   if n = 0 then get "zero"
  58.   else get word n of digits
  59. else
  60.   -- handle larger numbers
  61.   put n mod 10 into units -- separate units and tens
  62.   put n div 10 into tens
  63.   get word tens of "ten twenty thirty forty fifty sixty seventy eighty ninety"
  64.   if units <> 0 then put "-" & word units of digits after it
  65. end if
  66. return it
  67. end text100
  68.  
  69. -- toUpper -- Convert a lower case letter to upper case.
  70.  
  71. function toUpper a
  72. return numToChar(charToNum(a) - 32)
  73. end toUpper
  74.  
  75.  
  76.  
  77.  
  78. -- part 5 (field)
  79. -- low flags: 00
  80. -- high flags: 0000
  81. -- rect: left=281 top=105 right=122 bottom=348
  82. -- title width / last selected line: 0
  83. -- icon id / first selected line: 0 / 0
  84. -- text alignment: 0
  85. -- font id: 2
  86. -- text size: 12
  87. -- style flags: 0
  88. -- line height: 16
  89. -- part name: Date
  90.  
  91.  
  92. -- part 6 (field)
  93. -- low flags: 00
  94. -- high flags: 0000
  95. -- rect: left=360 top=105 right=122 bottom=384
  96. -- title width / last selected line: 0
  97. -- icon id / first selected line: 0 / 0
  98. -- text alignment: 0
  99. -- font id: 2
  100. -- text size: 12
  101. -- style flags: 0
  102. -- line height: 16
  103. -- part name: Year
  104.  
  105.  
  106. -- part 3 (field)
  107. -- low flags: 00
  108. -- high flags: 0000
  109. -- rect: left=86 top=145 right=162 bottom=366
  110. -- title width / last selected line: 0
  111. -- icon id / first selected line: 0 / 0
  112. -- text alignment: 0
  113. -- font id: 2
  114. -- text size: 12
  115. -- style flags: 0
  116. -- line height: 16
  117. -- part name: Pay to
  118. ----- HyperTalk script -----
  119. on closeField
  120.   if last character of background field "Pay to" <> "*" then put "*************************************************************" after background field "Pay to"
  121.   pass closeField
  122. end closeField
  123.  
  124.  
  125.  
  126. -- part 2 (field)
  127. -- low flags: 00
  128. -- high flags: 0000
  129. -- rect: left=388 top=145 right=162 bottom=468
  130. -- title width / last selected line: 0
  131. -- icon id / first selected line: 0 / 0
  132. -- text alignment: 65535
  133. -- font id: 4
  134. -- text size: 12
  135. -- style flags: 256
  136. -- line height: 16
  137. -- part name: Amount
  138. ----- HyperTalk script -----
  139. on closeField
  140.   repeat while first char of field "amount" is "*"
  141.     delete first char of field "amount"
  142.   end repeat
  143.   if number of chars in field "amount" < 3 then put ".00" after field "amount"
  144.   else if char (number of chars in field "amount") - 2 of field "amount" <> "." then put ".00" after field "amount"
  145.   put textAmount(field "Amount") into field "Text Amount"
  146.   repeat for 9 - (number of chars in field "amount") times
  147.     put "*" before field "amount"
  148.   end repeat
  149.   pass closeField
  150. end closeField
  151.  
  152.  
  153.  
  154.  
  155. -- part 1 (field)
  156. -- low flags: 01
  157. -- high flags: 0000
  158. -- rect: left=38 top=167 right=184 bottom=441
  159. -- title width / last selected line: 0
  160. -- icon id / first selected line: 0 / 0
  161. -- text alignment: 0
  162. -- font id: 2
  163. -- text size: 12
  164. -- style flags: 0
  165. -- line height: 16
  166. -- part name: Text Amount
  167.  
  168.  
  169. -- part 4 (field)
  170. -- low flags: 00
  171. -- high flags: 0000
  172. -- rect: left=55 top=225 right=242 bottom=224
  173. -- title width / last selected line: 0
  174. -- icon id / first selected line: 0 / 0
  175. -- text alignment: 0
  176. -- font id: 2
  177. -- text size: 12
  178. -- style flags: 0
  179. -- line height: 16
  180. -- part name: For
  181.  
  182.  
  183. -- part 7 (button)
  184. -- low flags: 00
  185. -- high flags: A003
  186. -- rect: left=7 top=301 right=323 bottom=142
  187. -- title width / last selected line: 0
  188. -- icon id / first selected line: 0 / 0
  189. -- text alignment: 1
  190. -- font id: 0
  191. -- text size: 12
  192. -- style flags: 0
  193. -- line height: 16
  194. -- part name: Back to First Card
  195. ----- HyperTalk script -----
  196. on mouseUp
  197.   visual effect barn door close
  198.   go first card
  199. end mouseUp
  200.  
  201.  
  202.  
  203.  
  204. -- part 8 (button)
  205. -- low flags: 00
  206. -- high flags: 2000
  207. -- rect: left=174 top=298 right=327 bottom=211
  208. -- title width / last selected line: 0
  209. -- icon id / first selected line: 9301 / 9301
  210. -- text alignment: 1
  211. -- font id: 0
  212. -- text size: 12
  213. -- style flags: 0
  214. -- line height: 16
  215. -- part name: Prev
  216. ----- HyperTalk script -----
  217. on mouseUp
  218.   visual effect scroll right
  219.   go to previous card of this bkgnd
  220. end mouseUp
  221.  
  222.  
  223. -- part 9 (button)
  224. -- low flags: 00
  225. -- high flags: 2000
  226. -- rect: left=276 top=298 right=327 bottom=312
  227. -- title width / last selected line: 0
  228. -- icon id / first selected line: 27009 / 27009
  229. -- text alignment: 1
  230. -- font id: 0
  231. -- text size: 12
  232. -- style flags: 0
  233. -- line height: 16
  234. -- part name: Next
  235. ----- HyperTalk script -----
  236. on mouseUp
  237.   visual effect scroll left
  238.   go to next card of this bkgnd
  239. end mouseUp
  240.  
  241.  
  242. -- part 11 (button)
  243. -- low flags: 00
  244. -- high flags: 2004
  245. -- rect: left=13 top=33 right=68 bottom=54
  246. -- title width / last selected line: 0
  247. -- icon id / first selected line: 20689 / 20689
  248. -- text alignment: 1
  249. -- font id: 0
  250. -- text size: 12
  251. -- style flags: 0
  252. -- line height: 16
  253. -- part name: Home
  254. ----- HyperTalk script -----
  255. on mouseUp
  256.   visual effect iris close
  257.   go home
  258. end mouseUp
  259.  
  260.  
  261.  
  262. -- part 13 (button)
  263. -- low flags: 00
  264. -- high flags: E005
  265. -- rect: left=420 top=88 right=110 bottom=477
  266. -- title width / last selected line: 0
  267. -- icon id / first selected line: 0 / 0
  268. -- text alignment: 1
  269. -- font id: 0
  270. -- text size: 12
  271. -- style flags: 0
  272. -- line height: 16
  273. -- part name: Print
  274. ----- HyperTalk script -----
  275. on mouseUp
  276.   put hilite of background button "Print" into background field "Print"
  277. end mouseUp
  278.  
  279.  
  280.  
  281. -- part 14 (field)
  282. -- low flags: 81
  283. -- high flags: 0000
  284. -- rect: left=426 top=91 right=109 bottom=467
  285. -- title width / last selected line: 0
  286. -- icon id / first selected line: 0 / 0
  287. -- text alignment: 0
  288. -- font id: 3
  289. -- text size: 12
  290. -- style flags: 0
  291. -- line height: 16
  292. -- part name: Print
  293.  
  294.  
  295. -- part 15 (button)
  296. -- low flags: 00
  297. -- high flags: A003
  298. -- rect: left=307 top=48 right=70 bottom=439
  299. -- title width / last selected line: 0
  300. -- icon id / first selected line: 0 / 0
  301. -- text alignment: 1
  302. -- font id: 0
  303. -- text size: 12
  304. -- style flags: 0
  305. -- line height: 16
  306. -- part name: Put today's date
  307. ----- HyperTalk script -----
  308. on mouseUp
  309.   get item 2 of the abbrev date
  310.   delete first char of it
  311.   put it into field "Date"
  312.   put char 3 to 4 of word 4 of the abbrev date into field "Year"
  313.   closeField
  314. end mouseUp
  315.  
  316.  
  317.  
  318. -- part 16 (field)
  319. -- low flags: 01
  320. -- high flags: 0000
  321. -- rect: left=38 top=92 right=112 bottom=88
  322. -- title width / last selected line: 0
  323. -- icon id / first selected line: 0 / 0
  324. -- text alignment: 0
  325. -- font id: 3
  326. -- text size: 12
  327. -- style flags: 0
  328. -- line height: 16
  329. -- part name: Number
  330.  
  331.  
  332. -- part 19 (button)
  333. -- low flags: 00
  334. -- high flags: A003
  335. -- rect: left=192 top=48 right=70 bottom=292
  336. -- title width / last selected line: 0
  337. -- icon id / first selected line: 0 / 0
  338. -- text alignment: 1
  339. -- font id: 0
  340. -- text size: 12
  341. -- style flags: 0
  342. -- line height: 16
  343. -- part name: New Check
  344. ----- HyperTalk script -----
  345. on mouseUp
  346.   doMenu "New Card"
  347.   send "mouseUp" to bkgnd button "Put Today's Date"
  348.   tabKey
  349.   tabKey
  350.   tabKey
  351. end mouseUp
  352.  
  353.  
  354.  
  355. -- part 20 (button)
  356. -- low flags: 00
  357. -- high flags: A003
  358. -- rect: left=76 top=48 right=70 bottom=176
  359. -- title width / last selected line: 0
  360. -- icon id / first selected line: 0 / 0
  361. -- text alignment: 1
  362. -- font id: 0
  363. -- text size: 12
  364. -- style flags: 0
  365. -- line height: 16
  366. -- part name: Delete
  367. ----- HyperTalk script -----
  368. on mouseUp
  369.   doMenu "Delete Card"
  370. end mouseUp
  371.  
  372.  
  373.  
  374. -- part 22 (button)
  375. -- low flags: 00
  376. -- high flags: 8000
  377. -- rect: left=395 top=294 right=342 bottom=490
  378. -- title width / last selected line: 0
  379. -- icon id / first selected line: 27009 / 27009
  380. -- text alignment: 1
  381. -- font id: 0
  382. -- text size: 12
  383. -- style flags: 0
  384. -- line height: 16
  385. -- part name: Next Marked Check
  386. ----- HyperTalk script -----
  387. on mouseUp
  388.   set hilite of the target to true
  389.   set lockScreen to true
  390.   set lockMessages to true
  391.   push card
  392.   go to next card
  393.   set lockMessages to false
  394.   visual effect scroll left
  395.   find word true in field "Print"
  396.   if the result is empty then pop card into it
  397.   else
  398.     beep
  399.     pop card
  400.   end if
  401.   set lockScreen to false
  402.   set hilite of the target to false
  403. end mouseUp
  404.